#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/6/10 0010 20:42
# @Author  : wzy
# @Site    : 
# @File    : readExcel.py
# @Software: PyCharm

from xlrd import open_workbook
from testFile.getpathInfo import get_path
path = get_path()
import os

class ReadExcel():
    def get_xls(self,xls_name,sheet_name):
        cls = []
        xlspath = os.path.join(path, "testFile", 'case', xls_name)
        file = open_workbook(xlspath)# 打开用例Excel
        sheet = file.sheet_by_name(sheet_name)
        rows = sheet.nrows
        for i in range(rows):
            if sheet.row_values(i)[0] != 'case_name':
                cls.append(sheet.row_values(i))
        return cls
readExcel = ReadExcel()
if __name__ == '__main__':
    #注意excel文件格式 在pycahrm中直接新建A.xlsx 会存在格式问题，最好直接在文件夹中新建xlsx
    print(readExcel.get_xls('userCase.xlsx', 'login'))